package com.cai.controller;

import com.cai.service.BulletScreenService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.io.Serializable;

@RestController
@RequestMapping("test")
public class TestController {
    @Autowired
    BulletScreenService bulletScreenService;
    @Autowired
    private RedisTemplate<Serializable,Serializable> redisTemplate;
    @GetMapping("/{userId}/{message}")
    public String sendMessage(@PathVariable String userId,@PathVariable String message){
        bulletScreenService.sendOneMessage(userId, message);
        return (String) redisTemplate.opsForValue().get("message:");
    }
}
